<template>
  <div>
      <card-container  key="container3"  style="margin-top: 16px" :title="rightConTitle" >
        <project-card @listenProjectCardUpdate="dataGetProject(1)" :isMy="true" v-if="rightList.length>0" v-for="(val,index) in rightList" :key="val.projectId" :info="val"></project-card>
        <empty-card v-if="rightList.length===0" height="556px"></empty-card>

      </card-container>
      <pagination key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
  </div>
</template>


<script>
  import ProjectCard from '../../../components/pc/projectCard';
  import CardContainer from '../../../components/pc/cardContainer';
  import config from '../../../action/config';
  import Pagination from "../../../components/pc/pagination";
  import EmptyCard from "../../../components/pc/emptyCard";

  export default {
    name:'project',
    data(){
      return{
        rightConType:1,
        leftList:[],
        rightList:[],
        pages:1,
      }
    },

    computed:{
      rightConTitle(){
          return '我的项目'
      },
    },
    components:{
      ProjectCard,CardContainer,Pagination,EmptyCard
    },


    methods:{
      dataGetProject(currentPage){
          this.$axios.$get(config.api.get.Project.myList, {
            params: {
              page: currentPage,
              size: 10
            }
          }).then((response) => {
            this.rightList = response.data.dataList;
            this.pages = response.data.totalPage;
          })
      },
      changePage(currentPage){
        //返回页数 请求新的数据

          this.dataGetProject(currentPage);
      }
    },
  }
</script>

<style lang="scss">

</style>
